package com.six.address.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.six.core.entity.Receive;
import com.six.address.service.ReceiveService;
import com.six.address.dao.ReceiveMapper;
import com.six.core.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 汪鹏
* @description 针对表【tb_receive】的数据库操作Service实现
* @createDate 2023-03-02 10:14:59
*/
@Service
public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> implements ReceiveService{

    @Autowired
    private ReceiveMapper receiveDao;
    @Override
    public Result findAllReceive(Integer userId) {
        QueryWrapper<Receive> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("userid", userId);
        List<Receive> receiveList = receiveDao.selectList(queryWrapper);
        return new Result(200,"查询成功",receiveList);
    }

    @Override
    public Result savaReceive(Receive receive) {
        int insert = receiveDao.insert(receive);
        return new Result(200,"添加成功");
    }

    @Override
    public Result deleteReceive(Integer receiveid) {
        receiveDao.deleteById(receiveid);
        return new Result(200,"删除成功");
    }

    @Override
    public Result updateReceive(Receive receive) {
        receiveDao.updateById(receive);
        return new Result(200,"修改成功");
    }
}




